package com.duxiaolie.demobook.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jms.Queue;

/**
 * @author: WeiYingYu
 * Description: 消息队列-消息生成者
 * <p>File Created at 2020/10/20</p>
 */
@RestController
public class QueueController {
    @Autowired
    private Queue queue;
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @RequestMapping("/send")
    public void send() {
        // 指定发送的目的地及内容
        this.jmsMessagingTemplate.convertAndSend(this.queue, "新发送的消息-杜小烈");
    }
}
